package com.qire.manhua.view.attributeBinder.attribute;

import com.qire.manhua.R;

import static com.bumptech.glide.request.target.Target.SIZE_ORIGINAL;

/**
 * 图片属性
 */
public class ImageAttribute {

    /**
     * 图片路径
     */
    private final String url;

    /**
     * 图片资源
     */
    private final int rid;

    /**
     * 占位符
     */
    private int placeholder = R.drawable.app_placeholder220x290;

    /**
     * 宽高
     */
    private int width = SIZE_ORIGINAL, height = SIZE_ORIGINAL;

    public ImageAttribute(String url, int placeholder) {
        this.url = url;
        this.placeholder = placeholder;
        this.rid = -1;
    }

    public ImageAttribute(String url) {
        this.url = url;
        this.rid = -1;
    }
    public ImageAttribute(int rid) {
        this.rid = rid;
        this.url = null;
    }

    public ImageAttribute setPlaceholder(int placeholder) {
        this.placeholder = placeholder;
        return this;
    }

    public ImageAttribute setWidth(int width) {
        this.width = width;
        return this;
    }

    public ImageAttribute setHeight(int height) {
        this.height = height;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public int getRid() {
        return rid;
    }

    public int getPlaceholder() {
        return placeholder;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }
}
